﻿@model LogManager.ViewModels.LogDetailViewModel
           
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Breadcrumb = string.Format("{0}", Model.Log.LogName);
}      

@section AsideLeft {
    @Html.Action("ListServerNavigation", "Log")
    <div id="properties-accordion">
        <h3><a href="#properties-info">@string.Format("{0} Info",@Model.Log.LogName)</a></h3>
        <div>@Html.DisplayFor(m => m.Log,"ObjectTable")</div>
    </div>
}

<h2>Log Detail for <b>@Model.Log.LogName</b></h2>

<div id="logdetail">
    <fieldset class="filter">
        <legend>
            <h3>Result View</h3>
        </legend>
        @Html.DropDownListFor(m => m.View, new SelectList(Model.Views))
    </fieldset>

    <br clear="all" />
    <fieldset>
        <legend><h3>Events</h3></legend>
        <div id="load-placeholder">
            <p id="events-placeholder">
                Importing and loading requested data.
                <br />
                Because the data imports asynchronously you won't see results immediately if it is the first time access.
                <br />
                Refresh at a later time to view the actual results.
                <br />
                <img src="@Url.Content("~/Content/Images/ajax-loader.gif")" alt="Loading" /><img src="@Url.Content("~/Content/Images/import.png")" alt="Loading" />
            </p>
        </div>
    </fieldset>
</div>


@section Foot{
<script type="text/javascript">
    jQuery(document).ready(function () {
        $('#events-placeholder').load('@(Url.Action("List","Event", new {serverName = Model.Log.ServerName,logName = Model.Log.LogName}))');
        
        @*Init accordion *@
        $( "#properties-accordion" ).accordion({
            collapsible: true,
            active: 0,
            autoHeight: false
        });

        $('#View').change(function() {
            $('#load-placeholder').html('<p id="load-placeholder"><img src="@Url.Content("~/Content/Images/ajax-loader.gif")" alt="Loading" /></p>');

            var model = {
                logName: '@Model.Log.LogName',
                serverName: '@Model.Log.ServerName',
                view: $('#View').val()
            };

            $.get('@(Url.Action("List","Event"))' + '?' + $.param(model), function(html) {
                $('#load-placeholder').html(html);
            });
        });
    });
</script>
}
